import coin.exchange.base.kr_rest.native_public_client_base as npubcb
import coin.exchange.upbit_v1.kr_rest.constants as exchange_constants


class UpbitNativePublicClient(npubcb.NativePublicClientBase):
  def __init__(self):
    npubcb.NativePublicClientBase.__init__(self, url="https://crix-api-endpoint.upbit.com/v1/crix")

  def query_candles_lines(self, symbol):
    return self._get_as_json("candles/lines", params=dict(code=symbol))

  def query_candles_minutes(self, symbol):
    return self._get_as_json("candles/minutes/5", params=dict(code=symbol, count=100))

  def query_recent(self, symbol):
    return self._get_as_json("recent", params=dict(codes=symbol))

  def queryAll(self):
    for symbol in exchange_constants.native_symbol_crix_list_for_test:
      print(self.query_candles_lines(symbol))
      print(self.query_candles_minutes(symbol))
      print(self.query_recent(symbol))
